/* Neon cyber style for the guessing game - Enhanced Edition */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Orbitron", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #f7f7ff;
  background: radial-gradient(circle at top, #1b2755 0, #050816 45%, #02030a 100%);
  overflow-x: hidden;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle at 20% 20%, rgba(0, 255, 255, 0.12), transparent),
    radial-gradient(circle at 80% 80%, rgba(255, 0, 255, 0.16), transparent);
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  z-index: 1;
}

.header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.title {
  font-family: "Press Start 2P", "Orbitron", system-ui, sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #e6f4ff;
  margin-bottom: 0.75rem;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.7), 0 0 18px rgba(0, 153, 255, 0.9);
  animation: pulse-glow 2.2s ease-in-out infinite alternate;
}

.subtitle {
  font-size: 0.95rem;
  color: rgba(226, 240, 255, 0.86);
}

.panel {
  width: min(640px, 100%);
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.glass {
  background: linear-gradient(135deg, rgba(12, 16, 40, 0.92), rgba(22, 38, 78, 0.9));
  border: 1px solid rgba(0, 255, 255, 0.18);
  backdrop-filter: blur(18px);
}

/* Difficulty selector */
.difficulty-selector {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(0, 20, 40, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 255, 0.15);
}

.difficulty-form {
  margin-bottom: 0.75rem;
}

.difficulty-select {
  width: 100%;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 255, 0.4);
  background: rgba(4, 8, 22, 0.9);
  color: #fff;
  outline: none;
  cursor: pointer;
  transition: border 0.18s ease, box-shadow 0.18s ease;
}

.difficulty-select:focus {
  border-color: #00f0ff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}

.custom-range-form {
  margin-top: 0.75rem;
}

.range-inputs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.range-input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 255, 0.3);
  background: rgba(4, 8, 22, 0.9);
  color: #fff;
  outline: none;
}

.range-separator {
  color: rgba(0, 255, 255, 0.6);
  font-weight: 600;
}

.guess-form {
  margin-bottom: 1.5rem;
}

.label {
  display: block;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(198, 224, 255, 0.8);
  margin-bottom: 0.4rem;
}

.input-row {
  display: flex;
  gap: 0.75rem;
}

.guess-input {
  flex: 1;
  min-width: 0;
  padding: 0.7rem 0.9rem;
  font-size: 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 255, 255, 0.5);
  background: rgba(4, 8, 22, 0.9);
  color: #fff;
  outline: none;
  box-shadow: 0 0 0 1px transparent;
  transition: border 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

.guess-input::placeholder {
  color: rgba(170, 201, 255, 0.42);
}

.guess-input:focus {
  border-color: #00f0ff;
  box-shadow: 0 0 0 1px rgba(0, 240, 255, 0.4), 0 0 18px rgba(0, 240, 255, 0.55);
  transform: translateY(-1px);
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-family: "Orbitron", system-ui, sans-serif;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease,
    color 0.18s ease;
}

.btn.primary {
  background: linear-gradient(120deg, #00f0ff, #00a3ff);
  color: #020611;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.65);
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.88);
}

.btn.primary:active {
  transform: translateY(0);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.7);
}

.btn.ghost {
  border: 1px solid rgba(0, 255, 255, 0.5);
  background: transparent;
  color: rgba(214, 236, 255, 0.9);
}

.btn.ghost:hover {
  background: rgba(0, 255, 255, 0.08);
  transform: translateY(-1px);
}

.btn.secondary {
  background: linear-gradient(120deg, #a855f7, #9333ea);
  color: #fff;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.65);
}

.btn.secondary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.88);
}

.btn.small {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.2rem;
}

.stat-card {
  background: rgba(0, 30, 60, 0.6);
  padding: 0.8rem 0.5rem;
  border-radius: 10px;
  text-align: center;
  border: 1px solid rgba(0, 255, 255, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 240, 255, 0.3);
}

.stat-label {
  font-size: 0.7rem;
  color: rgba(180, 210, 255, 0.7);
  margin-bottom: 0.3rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  color: #00f0ff;
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.9);
}

/* Status row */
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.attempts {
  color: rgba(199, 221, 255, 0.9);
}

.attempts-count {
  font-size: 1.2rem;
  font-weight: 700;
  color: #00f0ff;
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.9);
}

.badge {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid;
}

.badge-playing {
  border-color: rgba(0, 240, 255, 0.6);
  color: rgba(138, 242, 255, 0.9);
}

.badge-success {
  border-color: rgba(0, 255, 157, 0.8);
  color: rgba(174, 255, 210, 0.96);
  box-shadow: 0 0 12px rgba(0, 255, 157, 0.7);
}

.badge-warning {
  border-color: rgba(255, 193, 7, 0.8);
  color: rgba(255, 217, 102, 0.96);
  box-shadow: 0 0 12px rgba(255, 193, 7, 0.5);
}

.message-area {
  margin-bottom: 1.2rem;
}

.message {
  font-size: 1rem;
  margin-bottom: 0.4rem;
  color: #f8f9ff;
}

.message-muted {
  color: rgba(188, 210, 248, 0.78);
}

.hint {
  font-size: 0.9rem;
  color: rgba(129, 220, 255, 0.92);
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

/* Modal */
.modal {
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.modal-content {
  background: linear-gradient(135deg, rgba(12, 16, 40, 0.95), rgba(22, 38, 78, 0.93));
  margin: 5% auto;
  padding: 2rem;
  border: 1px solid rgba(0, 255, 255, 0.3);
  border-radius: 16px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
}

.modal-close {
  color: rgba(255, 255, 255, 0.6);
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: #00f0ff;
}

.modal-content h2 {
  color: #00f0ff;
  margin-bottom: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

.history-item {
  background: rgba(0, 30, 60, 0.6);
  padding: 1rem;
  margin-bottom: 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 255, 255, 0.15);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.history-item:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(0, 240, 255, 0.3);
}

.history-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.history-difficulty {
  color: #00f0ff;
  font-weight: 600;
}

.history-attempts {
  color: rgba(0, 255, 157, 0.9);
  font-weight: 700;
}

.history-details {
  font-size: 0.85rem;
  color: rgba(180, 210, 255, 0.7);
}

.footer {
  margin-top: 1.8rem;
  font-size: 0.75rem;
  color: rgba(151, 186, 230, 0.7);
}

.footer-text {
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Responsive tweaks */
@media (max-width: 640px) {
  .panel {
    padding: 1.4rem 1.25rem 1.25rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .input-row,
  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .range-inputs {
    flex-direction: column;
  }

  .modal-content {
    width: 95%;
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Dynamic font animation */
@keyframes pulse-glow {
  0% {
    text-shadow: 0 0 6px rgba(0, 255, 255, 0.6), 0 0 14px rgba(0, 153, 255, 0.7);
    transform: translateY(0);
  }
  100% {
    text-shadow: 0 0 14px rgba(0, 255, 255, 0.9), 0 0 28px rgba(0, 153, 255, 0.9);
    transform: translateY(-1px);
  }
}

